
// import Header from '@/components/header.vue'

import SideBar from '@/components/sidebar.vue'

import { createRouter, createWebHistory, RouterView } from 'vue-router'
import { qiankunWindow } from 'vite-plugin-qiankun/dist/helper';

const routes = [
  // { path: '/', redirect: '/tmo' },
  {
    path: '/tmo',
    name: "Tmo",
    component: RouterView,
    children: [
      {
        name: "TmoTenants",
        path: "tenants",
        component: () => import("@/views/tmo/tenants.vue")      },
      {
        name: "TmoLicenses",
        path: "licenses",
        component: () => import("@/views/tmo/licenses.vue"),
        props: true
      }
    ]
  },  
  {
    path: '/apm',
    component: RouterView,
    name: "Apm",
    children: [
      {
        name: "ApmComponents",
        path: "comps",
        component: () => import("@/views/apm/comps.vue")
      },
      {
        name: "ApmApps",
        path: "apps",
        component: () => import("@/views/apm/apps.vue")
      },
      {
        name: "ApmMenus",
        path: "menus",
        component: () => import("@/views/apm/menus.vue")
      },
      {
        name: "ApmRoles",
        path: "roles",
        component: () => import("@/views/apm/roles.vue")
      },
    ]
  },
  {
    path: '/cam',
    name: "Cam",
    component: RouterView,
    children: [
      {
        name: "CamUsers",
        path: "users",
        component: () => import("@/views/cam/users.vue")
      },
      {
        name: "CamGroups",
        path: "groups",
        component: () => import("@/views/cam/usergroups.vue")
      },
      {
        name: "CamLicenses",
        path: "licenses",
        component: () => import("@/views/cam/licenses.vue")
      },
    ]
  },
  {
    path: '/edm',
    name: "Edm", // 外部主数据或公共数据管理
    component: RouterView,
    children: [
      {
        name: "EdmRegions",
        path: "regions",
        component: () => import("@/views/emd/regions.vue")
      },
    ]
  },
  {
    path: '/mdm',
    name: "Mdm", // 主数据管理
    component: RouterView,
    children: [
      {
        name: "EdmOrgs",
        path: "orgs",
        component: () => import("@/views/mdm/orgs.vue")
      },
      {
        name: "EdmEmployees",
        path: "employees",
        component: () => import("@/views/mdm/employees.vue")
      },

    ]
  },
]

const router = createRouter({
  history: createWebHistory(qiankunWindow.__POWERED_BY_QIANKUN__ ? '/mc/' : '/'),
  routes: routes
})

export default router